﻿@{
    ViewBag.Title = "月用电量";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

@section scripts{
        <script src="~/Areas/Pacm/ViewModels/Pacm.com.js"></script>
        <script src="~/Areas/Pacm/ViewModels/Pacm.viewModel.search.js"></script>
        <script type="text/javascript">
            var data = @Html.Raw(Newtonsoft.Json.JsonConvert.SerializeObject(Model));
            var viewModel = function(){ 
                Pacm.viewModel.search.apply(this,arguments);
            };
            ko.bindingViewModel(new viewModel(data));

//            格式化电量
            function formatCus1(value) {
                var sign = value < 0 ? '-' : '';
                var val= sign + utils.formatNumber(Math.abs(value), '#,##0');
               return  '<span style="background-color:#ffee00;color:blue;">('+val+' 度)</span>';
            };
        </script>
}
        <div class="z-toolbar">
            <a id="a_refresh" href="#" plain="true" class="easyui-linkbutton" icon="icon-arrow_refresh" title="刷新" data-bind="click:refreshClick">刷新</a>
            @*<a id="a_add"    href="#" plain="true" class="easyui-linkbutton" icon="icon-add" title="新增" data-bind="click:addClick">新增</a>
            <a id="a_edit"   href="#" plain="true" class="easyui-linkbutton" icon="icon-edit" data-bind="click:editClick" title="编辑">编辑</a>
            <a id="a_del"    href="#" plain="true" class="easyui-linkbutton" icon="icon-cross" title="删除" data-bind="click:deleteClick">删除</a>
            <a id="a_audit"  href="#" plain="true" class="easyui-linkbutton" icon="icon-folder_key" data-bind="click:auditClick" title="审核">审核</a>*@
            <a id="a_export" href="#" class="easyui-splitbutton" data-options="menu:'#dropdown',iconCls:'icon-download'">导出</a>
        </div>

        <div id="dropdown" style="width:100px; display:none;">  
            <div data-options="iconCls:'icon-ext-xls'"      suffix="xls"    data-bind="click:downloadClick">Excel2003   </div>  
            <div data-options="iconCls:'icon-page_excel'"   suffix="xlsx"   data-bind="click:downloadClick">Excel2007   </div>  
            <div data-options="iconCls:'icon-ext-doc'"      suffix="doc"    data-bind="click:downloadClick">Word2003    </div>  
        </div> 

        <div id="condition" class="container_12" style="position:relative;">
            <div class="grid_1 lbl">电表名称</div>
            <div class="grid_2 val"><input type="text" style="width:405px"  data-bind="datasource:dataSource.dbzdItems ,comboboxValue:form.Yydl_Dbbh" class="z-txt easyui-combobox" data-options="showblank:true"/></div>
           
            <div class="clear"></div>
            <div class="grid_1 lbl">查询年度</div>
            <div class="grid_2 val"><input type="text" data-bind="datasource:dataSource.yearItems ,comboboxValue:form.Yydl_Year" class="z-txt easyui-combobox" data-options="showblank:true"/></div>
            <div class="grid_1 lbl">查询月份</div>
            <div class="grid_2 val"><input type="text" data-bind="datasource:dataSource.monthItems ,comboboxValue:form.Yydl_Month" class="z-txt easyui-combobox" data-options="showblank:true"/></div>

            <div class="clear"></div>
            <div class="prefix_9" style="position:absolute;top:5px;height:0;">  
                <a id="a_search" href="#" class="button button-blue" style="margin:0 15px;" data-bind="click:searchClick">查询</a> 
                <a id="a_reset" href="#" class="button button-blue" data-bind="click:clearClick">清空</a>
            </div>
        </div>

        <table id="gridlist" data-bind="datagrid:grid">
            <thead>  
            <tr>  
                <th field="Yydl_Year" sortable="false" align="center"      width="40">年度</th>  
                <th field="Yydl_Month" sortable="false" align="center"      width="40">月份</th>  
                <th field="Dbzd_Dbmc" sortable="false" align="left"    width="340">电表名称</th>  
                <th field="Yydl_Sjydl" sortable="false" align="left"  formatter="formatCus1"  width="160">用电量（度）</th>  
                <th field="CreateDate" sortable="false" align="center" formatter="com.formatTime"     width="120">采集时间</th>  
                <th field="UpdateDate" sortable="false" align="center" formatter="com.formatTime"     width="120">更新时间</th>  
            </tr>                            
            </thead>   
        </table> 
